import 'package:cloud_medicine/components/shop_picture.dart';
import 'package:flutter/material.dart';

class MyShopItem extends StatelessWidget {
  final num id;
  final String img;
  final String name;
  final num grade;
  final num iniDeliveryFee;
  final num deliveryFee;
  final Function myonTap;
  final double padding;
  const MyShopItem(
      {Key key,
      @required this.deliveryFee,
      @required this.grade,
      @required this.id,
      @required this.img,
      @required this.iniDeliveryFee,
      @required this.myonTap,
      @required this.padding,
      @required this.name})
      : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Material(
      color: Colors.transparent,
      borderRadius: BorderRadius.circular(12),
      elevation: 7,
      child: InkWell(
        splashColor: Colors.yellow.withOpacity(0.3),
        highlightColor: Colors.yellow.withOpacity(0.1),
        onTap: () {
          this.myonTap();
        },
        child: Container(
          color: Colors.white,
          padding: EdgeInsets.all(this.padding),
          margin: EdgeInsets.only(top: this.padding),
          child: Row(
            mainAxisAlignment: MainAxisAlignment.start,
            children: <Widget>[
              Container(
                child: ShopImg(imageStyle: 70, imgUrl: this.img),
              ),
              SizedBox(
                width: 10,
              ),
              Expanded(
                  flex: 2,
                  child: Column(
                    mainAxisAlignment: MainAxisAlignment.end,
                    crossAxisAlignment: CrossAxisAlignment.start,
                    children: <Widget>[
                      Container(
                        child: Text(
                          this.name,
                          style: TextStyle(fontSize: 24, fontFamily: 'main'),
                        ),
                      ),
                      Container(
                        padding: EdgeInsets.only(top: 10),
                        child: Text('评分：${this.grade}'),
                      )
                    ],
                  )),
              Column(
                children: <Widget>[
                  Text('配送￥${this.deliveryFee}'),
                  SizedBox(
                    height: 10,
                  ),
                  Text('起送￥${this.iniDeliveryFee}')
                ],
              )
            ],
          ),
        ),
      ),
    );
  }
}
